package com.ztf.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/config")
@RefreshScope
public class NacosConfigController {
    // 使用nacos作为配置中心中的属性
    @Value("${person:123}")
    private String person;

    @Value("${useLocalCache:false}")
    private boolean useLocalCache;


    @RequestMapping("/nacosconfig")
    public String nacosconfig(){
        System.out.println("person="+person);
        System.out.println("useLocalCache="+useLocalCache);
        return this.person;
    }
}
